# Prepend an L (ell) to turn to a wide literal constant from a string one. Warrantied assumption is made that only single byte characters will form the values of yytname that is dealt with here.
# We say "warrantied" backed/layed on the fact that this array is created from hardcoded values from our own grammar, meaning that the values are authored by our hands, and we know to be only valid English characters,
# and because the C standard (ISO/IEC) settles a prerequisite that the plattform shall support a character set at least as comprehensive as those of the tokens used in the grammar that give rise to yytname.
# Not that will it in use, however in theory any character of LC_LOCALE can be supported on the plattform where Notehaus is compiled. Because it's about a baremetal source-to-source transcription,
# the characters of token types in the parser generated C source file are just well for the Translation Environment to map them in the first phase of source-to-object translation.
# Again, the following source-to-source transcription, plus the L prepended, should make effective wide strings literal not limited to ASCII characters, making languages with internationalized keywords.
# Mainly led by the above reasoning, the decision is to build wtname in a source generation phase fashion, rather than computing it at runtime from yytname.
# The trick, under the assumption the theory's correct, is that the multibyte characters in the C source, with the prefix L, interpreted by the translation environment, as defined by the standard, give rise to the wide characters in the running program. This means plattform independency to an extent compared with as wide characters are to multibyte characters.
echo "$(sed '/yytname\s*\[\s*\]\s*=/!d; s/yytname/wtname/; s/char/wchar_t/; :x /^};$/M!{N;bx}; s/"\([^"\]\|\(\\\\\)*\\"\)*"/L&/g; q;' java7.tab.c)" > wtname.h
echo "$(sed '/yytoknum\s*\[\s*\]\s*=/!d; s/yytoknum/mytoknum/; :x /^};$/M!{N;bx}; q;' java7.tab.c)" >> wtname.h
